#include <iostream>
#include <stdbool.h>
using namespace std;
int GetMonthDay(int year, int month)
{
    int MonthDay[13] = { 0,31,28,31,
    30,31,30,31,31,30,31,30,31 };
    if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0))
        return 29;
    else
        return MonthDay[month];
}
class Date
{
public:
    Date(int date)
    {
        _year = date / 10000;
        _month = (date % 10000) / 100;
        _day = date % 100;
    }
    bool operator>(Date d)
    {
        if (_year > d._year)
            return true;
        if (_year == d._year && _month > d._month)
            return true;
        if (_year == d._year && _month == d._month && _day > d._day)
            return true;
        return false;
    }
    bool operator==(Date d)
    {
        if (_year == d._year && _month == d._month && _day == d._day)
            return true;
        return false;
    }
    Date& operator+=(int day)
    {
        _day += day;
        while (_day > GetMonthDay(_year, _month))
        {
            _day -= GetMonthDay(_year, _month);
            _month++;
            if (_month == 13)
            {
                _year++;
                _month = 1;
            }
        }
        return *this;
    }
    int operator-(Date d)
    {
        Date min = *this;
        Date max = d;
        if (*this > d)
        {
            min = d;
            max = *this;
        }
        int gap = 1;
        while (!(min == max))
        {
            min += 1;
            gap++;
        }
        return gap;
    }
private:
    int _year;
    int _month;
    int _day;
};
int main() {
    int d1 = 0;
    int d2 = 0;
    cin >> d1;
    cin >> d2;
    Date dt1(d1);
    Date dt2(d2);
    cout << dt1 - dt2 << endl;
    return 0;
}
